/*
 * Created on Feb 8, 2004
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
package littlecyberwar.ui;

import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;


import littlecyberwar.model.*;
import littlecyberwar.ui.*;
import littlecyberwar.util.*;
import littlecyberwar.tool.MouseHandler;
/**
 * @author Milton  Soong
 *
 * To change the template for this generated type comment go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
public class DiceAction extends LCWAction { 
	private DieRollDialog dieRollTool;
	
  public DiceAction(String text, ImageIcon icon,
					String desc, KeyStroke k, MainFrame fr) {
	  super(text, icon, desc, k, fr);
	  InternalCmdFacade mod = fr.getIcmd();
	  dieRollTool = new DieRollDialog(fr, mod);
	  dieRollTool.pack();
  }
	
  public void actionPerformed(ActionEvent e) {
	  Dimension dlgSize = dieRollTool.getPreferredSize();
	  Dimension frmSize = frame.getSize();
	  Point loc = frame.getLocation();
	  dieRollTool.setLocation((frmSize.width - dlgSize.width) / 2 + loc.x, (frmSize.height - dlgSize.height) / 2 + loc.y);	
	  dieRollTool.show();
  }
}

